//package com.yunhe.authority.controller.authority;
//
//import com.yunhe.authority.domain.authority.FirmStaticData;
//import com.yunhe.authority.service.authority.FirmStaticDataService;
//import com.yunhe.common.annotation.OperationRecord;
//import com.yunhe.common.constant.SystemConsts;
//import com.yunhe.common.exception.ArgumentErrorException;
//import com.yunhe.common.exception.ObjectNotFoundException;
//import com.yunhe.common.exception.UniqueConstraintsException;
//import com.yunhe.common.model.ResultObject;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.Optional;
//
///**
// * @ClassName FirmStaticDataController
// * @Description 单位静态数据维护
// * @Author HeTao
// * @Date 2020/11/2 11:03
// * @Version 1.0
// **/
//@Api(value = "firmStaticData",description = "单位静态数据维护", tags = {"Authority_FirmStaticData"})
//@RestController
//@RequestMapping("/firm/staticData")
//public class FirmStaticDataController {
//
//    @Autowired
//    private FirmStaticDataService firmStaticDataService;
//
//    /**
//     * 新增单位静态数据
//     * @param firmStaticData 单位静态对象
//     * @param firmId 单位ID
//     * @return
//     * @throws ArgumentErrorException
//     * @throws UniqueConstraintsException
//     * @throws ObjectNotFoundException
//     */
//    @ApiOperation("新增单位静态数据")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "firmId", value = "单位ID", dataType = "long", paramType = "query")
//    })
//    @RequestMapping(method = RequestMethod.POST)
//    @OperationRecord(menu = "单位静态数据管理", actionType = SystemConsts.ACTION.ADD)
//    public ResponseEntity<ResultObject> post(@RequestBody FirmStaticData firmStaticData,
//                                             @RequestParam("firmId") Optional<Long> firmId)
//            throws  ObjectNotFoundException {
//        FirmStaticData newFirmStaticData = firmStaticDataService.createFirmStaticData(firmStaticData, firmId.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(newFirmStaticData), HttpStatus.OK);
//    }
//
//    /**
//     * 更新单位静态数据（更新全部字段）
//     * @param id 单位静态数据ID
//     * @param firmStaticData 单位静态对象
//     * @param firmId 单位ID
//     */
//    @ApiOperation("更新单位静态数据（更新全部字段）")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "单位静态数据ID", required = true, dataType = "long", paramType = "path"),
//            @ApiImplicitParam(name = "firmId", value = "单位ID", dataType = "long", paramType = "query")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
//    @OperationRecord(menu = "单位静态数据管理", actionType = SystemConsts.ACTION.EDIT)
//    public ResponseEntity<ResultObject> put(@PathVariable("id") Long id,
//                                            @RequestBody FirmStaticData firmStaticData,
//                                            @RequestParam("firmId") Optional<Long> firmId)
//            throws  ObjectNotFoundException {
//        firmStaticData.setId(id);
//        FirmStaticData newFirmStaticData = firmStaticDataService.updateFirmStaticData(firmStaticData, firmId.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(newFirmStaticData), HttpStatus.OK);
//    }
//
//    /**
//     * 更新单位（更新指定字段）
//     * @param id
//     * @param firmId
//     * @param area
//     * @param taxes
//     * @param ssCompNum
//     * @param intendSsCompNum
//     * @param electromechanicalCompNum
//     * @param packingCompNum
//     * @param materialsCompNum
//     * @param automotiveCompNum
//     * @param foodCompNum
//     * @param otherCompNum
//     * @param industryNum
//     * @param compNumStaffAbove0
//     * @param compNumStaffAbove50
//     * @param compNumStaffAbove100
//     * @param compNumStaffAbove150
//     * @param allCompNum
//     * @param signedCompNum
//     * @param investmentCompNum
//     * @param interestSignCompNum
//     * @param annualOutputValue
//     * @param allOfficeNum
//     * @param solvingEmployment
//     * @param regulatoryEquipmentNum
//     * @param alarmProcessingRate
//     * @param monitoringEquipmentNum
//     * @param equipmentIntactRate
//     * @param inspectionsNum
//     * @param mediumAlarmNum
//     * @param mediumAlarmProcessingRate
//     * @param heaviestAlarmNum
//     * @param heaviestAlarmProcessingRate
//     * @param legalFinancialServiceNum
//     * @param warehousingLogisticsServiceNum
//     * @param policyDeclarationServiceNum
//     * @param sharedCommunityServiceNum
//     * @param financeServiceNum
//     * @param trainingServiceNum
//     * @param otherServiceNum
//     * @param energyCompListMonth
//     * @param energyCompListYear
//     * @param annualOutputValueStationList
//     * @param compNumStationList
//     * @param solvingEmploymentStationList
//     * @return
//     * @throws ArgumentErrorException
//     * @throws ObjectNotFoundException
//     * @throws UniqueConstraintsException
//     */
//    @ApiOperation("更新单位（更新指定字段）")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "单位静态数据ID", required = true, dataType="long", paramType = "path"),
//            @ApiImplicitParam(name = "firmId", value = "单位ID", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "area", value = "总占地面积", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "taxes", value = "年均税收", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "ssCompNum", value = "规上企业数", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "intendSsCompNum", value = "拟上规企业数", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "electromechanicalCompNum", value = "企业数量_机电", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "packingCompNum", value = "企业数量_包装", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "materialsCompNum", value = "企业数量_新材料", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "automotiveCompNum", value = "企业数量_汽车产品", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "foodCompNum", value = "企业数量_食品", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "otherCompNum", value = "企业数量_其他", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "industryNum", value = "行业数", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "compNumStaffAbove0", value = "职工范围内的企业数量0~50", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "compNumStaffAbove50", value = "职工范围内的企业数量50~100", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "compNumStaffAbove100", value = "职工范围内的企业数量100~150", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "compNumStaffAbove150", value = "职工范围内的企业数量150~无穷", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "allCompNum", value = "企业总数（入驻企业数）", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "signedCompNum", value = "企业数量_正式签约", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "investmentCompNum", value = "企业数量_投资", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "interestSignCompNum", value = "企业数量_意向签约", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "annualOutputValue", value = "年产值", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "allOfficeNum", value = "可入驻总企业数（入驻率=入驻企业数/可入驻总企业数）", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "solvingEmployment", value = "解决就业", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "regulatoryEquipmentNum", value = "监管设备数量", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "alarmProcessingRate", value = "告警处理率", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "monitoringEquipmentNum", value = "监控设备数量", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "equipmentIntactRate", value = "设备完好率", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "inspectionsNum", value = "巡查检查次数", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "mediumAlarmNum", value = "一般告警数量", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "mediumAlarmProcessingRate", value = "一般告警已解决率", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "heaviestAlarmNum", value = "严重告警数量", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "heaviestAlarmProcessingRate", value = "严重告警已解决率", dataType = "double", paramType = "query"),
//            @ApiImplicitParam(name = "legalFinancialServiceNum", value = "企业服务次数_法律财务咨询", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "warehousingLogisticsServiceNum", value = "企业服务次数_仓储物流", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "policyDeclarationServiceNum", value = "企业服务次数_政策申报", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "sharedCommunityServiceNum", value = "企业服务次数_共享社区", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "financeServiceNum", value = "企业服务次数_金融", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "trainingServiceNum", value = "企业服务次数_商学院培训", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "otherServiceNum", value = "企业服务次数_其他", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "energyCompListMonth", value = "万元GDP能耗月排名（每个企业的数据以逗号间隔）", dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "energyCompListYear", value = "万元GDP能耗年排名（每个企业的数据以逗号间隔）", dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "annualOutputValueStationList", value = "年产值排名（每个企业的数据以逗号间隔）", dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "compNumStationList", value = "入驻企业数排名（每个企业的数据以逗号间隔）", dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "solvingEmploymentStationList", value = "解决就业排名（每个企业的数据以逗号间隔）", dataType = "String", paramType = "query")
//
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.PATCH)
//    @OperationRecord(menu = "单位静态数据管理", actionType = SystemConsts.ACTION.EDIT)
//    public ResponseEntity<ResultObject> patch(@PathVariable("id") Long id,
//                                              @RequestParam("firmId") Optional<Long> firmId,
//                                              @RequestParam("area") Optional<Double> area,
//                                              @RequestParam("taxes") Optional<Double> taxes,
//                                              @RequestParam("ssCompNum") Optional<Long> ssCompNum,
//                                              @RequestParam("intendSsCompNum") Optional<Long> intendSsCompNum,
//                                              @RequestParam("electromechanicalCompNum") Optional<Long> electromechanicalCompNum,
//                                              @RequestParam("packingCompNum") Optional<Long> packingCompNum,
//                                              @RequestParam("materialsCompNum") Optional<Long> materialsCompNum,
//                                              @RequestParam("automotiveCompNum") Optional<Long> automotiveCompNum,
//                                              @RequestParam("foodCompNum") Optional<Long> foodCompNum,
//                                              @RequestParam("otherCompNum") Optional<Long> otherCompNum,
//                                              @RequestParam("industryNum") Optional<Long> industryNum,
//                                              @RequestParam("compNumStaffAbove0") Optional<Long> compNumStaffAbove0,
//                                              @RequestParam("compNumStaffAbove50") Optional<Long> compNumStaffAbove50,
//                                              @RequestParam("compNumStaffAbove100") Optional<Long> compNumStaffAbove100,
//                                              @RequestParam("compNumStaffAbove150") Optional<Long> compNumStaffAbove150,
//                                              @RequestParam("allCompNum") Optional<Long> allCompNum,
//                                              @RequestParam("signedCompNum") Optional<Long> signedCompNum,
//                                              @RequestParam("investmentCompNum") Optional<Long> investmentCompNum,
//                                              @RequestParam("interestSignCompNum") Optional<Long> interestSignCompNum,
//                                              @RequestParam("annualOutputValue") Optional<Double> annualOutputValue,
//                                              @RequestParam("allOfficeNum") Optional<Long> allOfficeNum,
//                                              @RequestParam("solvingEmployment") Optional<Long> solvingEmployment,
//                                              @RequestParam("regulatoryEquipmentNum") Optional<Long> regulatoryEquipmentNum,
//                                              @RequestParam("alarmProcessingRate") Optional<Double> alarmProcessingRate,
//                                              @RequestParam("monitoringEquipmentNum") Optional<Long> monitoringEquipmentNum,
//                                              @RequestParam("equipmentIntactRate") Optional<Double> equipmentIntactRate,
//                                              @RequestParam("inspectionsNum") Optional<Long> inspectionsNum,
//                                              @RequestParam("mediumAlarmNum") Optional<Long> mediumAlarmNum,
//                                              @RequestParam("mediumAlarmProcessingRate") Optional<Double> mediumAlarmProcessingRate,
//                                              @RequestParam("heaviestAlarmNum") Optional<Long> heaviestAlarmNum,
//                                              @RequestParam("heaviestAlarmProcessingRate") Optional<Double> heaviestAlarmProcessingRate,
//                                              @RequestParam("legalFinancialServiceNum") Optional<Long> legalFinancialServiceNum,
//                                              @RequestParam("warehousingLogisticsServiceNum") Optional<Long> warehousingLogisticsServiceNum,
//                                              @RequestParam("policyDeclarationServiceNum") Optional<Long> policyDeclarationServiceNum,
//                                              @RequestParam("sharedCommunityServiceNum") Optional<Long> sharedCommunityServiceNum,
//                                              @RequestParam("financeServiceNum") Optional<Long> financeServiceNum,
//                                              @RequestParam("trainingServiceNum") Optional<Long> trainingServiceNum,
//                                              @RequestParam("otherServiceNum") Optional<Long> otherServiceNum,
//                                              @RequestParam("energyCompListMonth") Optional<String[]> energyCompListMonth,
//                                              @RequestParam("energyCompListYear") Optional<String[]> energyCompListYear,
//                                              @RequestParam("annualOutputValueStationList") Optional<String[]> annualOutputValueStationList,
//                                              @RequestParam("compNumStationList") Optional<String[]> compNumStationList,
//                                              @RequestParam("solvingEmploymentStationList") Optional<String[]> solvingEmploymentStationList)
//            throws ObjectNotFoundException {
//        FirmStaticData newFirmStaticData = firmStaticDataService.updateFirmStaticData(id, firmId.orElse(null), area.orElse(null),
//                taxes.orElse(null), ssCompNum.orElse(null), intendSsCompNum.orElse(null), electromechanicalCompNum.orElse(null),
//                packingCompNum.orElse(null), materialsCompNum.orElse(null), automotiveCompNum.orElse(null),
//                foodCompNum.orElse(null), otherCompNum.orElse(null), industryNum.orElse(null), compNumStaffAbove0.orElse(null)
//                , compNumStaffAbove50.orElse(null), compNumStaffAbove100.orElse(null), compNumStaffAbove150.orElse(null), allCompNum.orElse(null)
//                , signedCompNum.orElse(null), investmentCompNum.orElse(null), interestSignCompNum.orElse(null), annualOutputValue.orElse(null)
//                , allOfficeNum.orElse(null), solvingEmployment.orElse(null), regulatoryEquipmentNum.orElse(null), alarmProcessingRate.orElse(null)
//                , monitoringEquipmentNum.orElse(null), equipmentIntactRate.orElse(null), inspectionsNum.orElse(null)
//                , mediumAlarmNum.orElse(null), mediumAlarmProcessingRate.orElse(null), heaviestAlarmNum.orElse(null), heaviestAlarmProcessingRate.orElse(null)
//                , legalFinancialServiceNum.orElse(null), warehousingLogisticsServiceNum.orElse(null), policyDeclarationServiceNum.orElse(null), sharedCommunityServiceNum.orElse(null)
//                , financeServiceNum.orElse(null), trainingServiceNum.orElse(null), otherServiceNum.orElse(null), energyCompListMonth.orElse(null)
//                , energyCompListYear.orElse(null), annualOutputValueStationList.orElse(null), compNumStationList.orElse(null), solvingEmploymentStationList.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(newFirmStaticData), HttpStatus.OK);
//    }
//
//    /**
//     * 根据单位id获得单位静态数据
//     * @param  firmId
//     */
//    @ApiOperation("据单位id获得单位静态数据")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "firmId", value = "单位id", required = true, dataType = "long", paramType = "path")
//    })
//    @RequestMapping(value = "/{firmId}", method = RequestMethod.GET)
//    public ResponseEntity<ResultObject> getByCode(@PathVariable("firmId") Long firmId) {
//        FirmStaticData firmStaticData= firmStaticDataService.findByFirmId(firmId);
//        return new ResponseEntity<>(new ResultObject<>(firmStaticData), HttpStatus.OK);
//    }
//
//}
